import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    meta: { title: "Home" },
    component: () => import("@/views/homePage.vue"),
  },
  {
    path: "/admin/index",
    name: "Index",
    meta: { title: "首页", icon: "local_home" },
    component: () => import("@/views/layoutPage.vue"),
    redirect: "/admin/index",
    children: [
      {
        path: "/admin/index",
        name: "Index",
        meta: { title: "首页", hide: true },
        component: () => import("@/views/indexPage.vue"),
      },
      {
        path: "/admin/test",
        name: "Test",
        meta: { title: "测试页面", hide: true },
        component: () => import("@/views/testPage.vue"),
      },
      {
        path: "/admin/test2",
        name: "Test2",
        meta: { title: "测试页面2", hide: true },
        component: () => import("@/views/testPage2.vue"),
      },
      {
        path: "/admin/test3",
        name: "Test3",
        meta: { title: "测试页面3", hide: true },
        component: () => import("@/views/testPage3.vue"),
      },
      {
        path: "/admin/test4",
        name: "Test4",
        meta: { title: "测试页面4", hide: true },
        component: () => import("@/views/testPage4.vue"),
      },
    ],
  },
];

export const router = createRouter({
  // history: createWebHashHistory(import.meta.env.BASE_URL),
  history: createWebHistory(),
  routes,
});
